package com.ceba.test.modules.filemanage.service;


import java.util.Map;

import com.ceba.base.web.service.IBaseService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.ceba.test.modules.filemanage.dao.GFileDao;
import com.ceba.test.modules.filemanage.entity.GFile;
import com.ceba.test.modules.filemanage.entity.GFileRelaction;

import abc.data.DataRow;
import abc.user.IUser;


public class GFileService extends IBaseService {
	static Logger logger = LoggerFactory.getLogger(GFileService.class);

	private GFileDao gFileDao;



	/**
	 * 添加纪录
	 * @param gFile
	 * @return
	 */
	public boolean addFile(GFile gFile) throws Exception{
		return gFileDao.addFile(gFile);
	}

	public boolean addGFileRelaction(GFileRelaction gfr){
		return gFileDao.addGFileRelaction(gfr);
	}

	/**
	 * 根据id获取
	 * @param fileId
	 * @return
	 */
	public GFile getGFileByFileId(String fileId){
		return gFileDao.getGFileByFileId(fileId);
	}
	/**
	 * 删除
	 * @param invalidFileId
	 * @return
	 * @throws Exception
	 */
	public boolean deleteFileByFileId(String invalidFileId) throws Exception{
		return gFileDao.deleteFileByFileId(invalidFileId);
	}
	
	/*
	 * 根据id获取关联文件
	 */
	public GFileRelaction getGFileRelactionById(String gFileRelactionId){
		return gFileDao.getGFileRelactionById(gFileRelactionId);
	}
	
	/*
	 * 拷贝datarow对象值到GFile
	 */
	public void copyDataRowToGFile(DataRow dr,GFile gFile){
		 gFileDao.copyDataRowToGFile(dr,gFile);
	}
	
	
	/**
	 * 
	 * @param  id
	 * @param fieldName
	 *            字段ID
	 * @return
	 */
	public String getFieldValue(String table,String id, String fieldName) throws Exception {
		return gFileDao.getFieldValue(table, id, fieldName);
	}
	
	public String fileIdGetVirtualPath(String g_fileId) throws Exception{
		return gFileDao.fileIdGetVirtualPath(g_fileId);
	}
	

	public GFileDao getgFileDao() {
		return gFileDao;
	}

	public void setgFileDao(GFileDao gFileDao) {
		this.gFileDao = gFileDao;
	}
	
	
	
}
